<template>
  <div class="homepage-container">
    <!-- 头部介绍 -->
    <div class="hero-section">
      <h1 class="hero-title">工具库</h1>
      <p class="hero-subtitle">一站式开发工具集合，提升你的开发效率</p>
    </div>

    <!-- 工具网格 -->
    <div class="tools-grid">
      <div 
        v-for="tool in tools" 
        :key="tool.id" 
        class="tool-card"
        @click="router.push(tool.path)"
      >
        <div class="tool-icon">{{ tool.icon }}</div>
        <h3 class="tool-title">{{ tool.title }}</h3>
        <p class="tool-description">{{ tool.description }}</p>
        <div class="tool-tags">
          <span v-for="tag in tool.tags" :key="tag" class="tag">{{ tag }}</span>
        </div>
        <div class="tool-arrow">›</div>
      </div>
    </div>
  </div>
</template>

<script setup>
const tools = [
  {
    id: 1,
    title: '工作流管理',
    icon: '⚡',
    description: '可视化工作流设计器，拖拽式构建复杂业务流程，提升团队协作效率',
    tags: ['流程图', '自动化', '协作'],
    path: '/workflow'
  },
  {
    id: 2,
    title: 'AI智能聊天',
    icon: '🤖',
    description: '集成最新AI模型，支持代码生成、问题解答、智能助手等多种功能',
    tags: ['AI', '聊天', '智能'],
    path: '/ai-chat'
  },
  {
    id: 3,
    title: '数据表管理',
    icon: '📊',
    description: '强大的数据表格工具，支持导入导出、实时编辑、数据可视化',
    tags: ['数据', '表格', '可视化'],
    path: '/data-control'
  },
  {
    id: 4,
    title: '局域网资源',
    icon: '🌐',
    description: '局域网文件共享平台，快速分享文件、资源管理、团队协作',
    tags: ['共享', '网络', '文件'],
    path: '/lan-share'
  },
  {
    id: 5,
    title: 'Gitee热力图',
    icon: '📈',
    description: '代码提交可视化，生成精美的贡献热力图，展示开发活动统计',
    tags: ['Git', '统计', '可视化'],
    path: '/statistics'
  },
  {
    id: 6,
    title: '低代码平台',
    icon: '🎨',
    description: '可视化页面构建器，拖拽组件快速搭建应用，无需编程基础',
    tags: ['低代码', '可视化', '快速'],
    path: '/low-code'
  },
  {
    id: 7,
    title: '代码块分享',
    icon: '💻',
    description: '代码片段管理和分享平台，支持语法高亮、版本控制、团队共享',
    tags: ['代码', '分享', '管理'],
    path: '/code-share'
  }
]

const router = useRouter()
</script>

<style scoped>
.homepage-container {
  min-height: 100vh;
  background-color: #f2f2f7;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.hero-section {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 60px;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1c1c1e;
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: #8e8e93;
  margin: 0;
  font-weight: 400;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  max-width: 1000px;
  margin: 0 auto;
}

.tool-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 0.5px solid rgba(0, 0, 0, 0.04);
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.tool-card:active {
  transform: scale(0.98);
}

.tool-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  display: inline-block;
}

.tool-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #1c1c1e;
  letter-spacing: -0.01em;
}

.tool-description {
  font-size: 0.9rem;
  color: #8e8e93;
  line-height: 1.5;
  margin: 0 0 16px 0;
  font-weight: 400;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  background: #f2f2f7;
  color: #8e8e93;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tool-arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 1.2rem;
  color: #c7c7cc;
  transition: all 0.2s ease;
  font-weight: 600;
}

.tool-card:hover .tool-arrow {
  color: #007aff;
  transform: translateX(2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .hero-section {
    padding-top: 40px;
    margin-bottom: 32px;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .tool-card {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .homepage-container {
    padding: 16px;
  }
  
  .hero-title {
    font-size: 1.8rem;
  }
  
  .tool-card {
    padding: 18px;
  }
  
  .tools-grid {
    gap: 10px;
  }
}
</style>
